from django import forms
from django.forms import inlineformset_factory
from .models import Test, Task

class TestForm(forms.ModelForm):
    class Meta:
        model = Test
        fields = ['title', 'description', 'competition', 'due_date']

class TaskForm(forms.ModelForm):
    class Meta:
        model = Task
        fields = ['title', 'description', 'image']

TaskFormSet = inlineformset_factory(Test, Task, form=TaskForm, extra=1, can_delete=True)
